package de.baumann.browser.api.net

import de.baumann.browser.api.net.base.BaseUrl
import de.baumann.browser.api.net.vo.Card
import de.baumann.browser.api.net.vo.MyCard
import de.baumann.browser.api.net.vo.Result
import de.baumann.browser.api.net.vo.Role
import io.reactivex.Observable
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST

@BaseUrl(ApiKey.CARD_MODEL)
interface CardApiService {

    @POST(ApiKey.GET_USER_ROLE)
    fun getUserRole(): Observable<Result<Role>>

    @POST(ApiKey.GET_CARDS)
    fun getCards(): Observable<Result<List<Card>>>

    @POST(ApiKey.GET_MY_CARD)
    fun getMyCard(): Observable<Result<MyCard>>

    @FormUrlEncoded
    @POST(ApiKey.CALLAFTERBUY)
    fun callAfterBuy(@Field("cardId") cardId: String,
                     @Field("transactionHash") hash: String): Observable<Result<Any>>
}